﻿using System;
using System.Text;
using System.Net;
using System.Linq;
using Param;
using FrameIdentityReq.Network;
using FrameIdentityReq.Frames;

namespace FrameIdentityReq
{
    class Program
    {
        static Program aProgram;
        CraneParams aCraneParams;

        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            aProgram = new Program();
            aProgram.Start(args);
        }

        void Start(string[] args)
        {

            BaseFrame aBaseFrame = new BaseFrame();
            UInt16 x = aBaseFrame.CRC.Value;



            aCraneParams = new CraneParams(args);

            IdentityReqFrame aIdentityReqFrame = new IdentityReqFrame();

            aIdentityReqFrame.HardwareSerialNum.Value = aCraneParams.HardwareSerialNum;
            aIdentityReqFrame.FactoryCode.Value = aCraneParams.FactoryCode;
            aIdentityReqFrame.UserName.Value = "ljt";
            aIdentityReqFrame.PWD.Value = "asdfg";

            AsyncSocket aSocket_Client = new AsyncSocket(aCraneParams.Port, aCraneParams.BufferSize);
            aSocket_Client.SendTo(aCraneParams.RemoteIP, aIdentityReqFrame.Buffer.ToArray());
        }

    }
}
